/*
 * Copyright 2009 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package dk.simonvogensen.itodo.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import dk.simonvogensen.itodo.client.TodoApi;
import dk.simonvogensen.itodo.shared.model.Config;
import dk.simonvogensen.itodo.shared.model.TodoItem;

import java.util.List;

/**
 * Implementation of Todo API.
 */
@SuppressWarnings("serial")
public class TodoApiImpl extends RemoteServiceServlet implements TodoApi {

    private TodoService service = new TodoService(PMF.get());

    public List<TodoItem> getTodoItemList(int startIndex, int endIndex) {
        return service.getTodoItemList(startIndex, endIndex);
    }

    public String createTodo() {
        return service.createTodo();
    }

    public void updateTodo(TodoItem item) {
        service.updateTodo(item);
    }

    public void deleteTodo(TodoItem item) {
        service.deleteTodo(item);
    }

    public String updateConfig(Config config) {
        return service.updateConfig(config);
    }

    public TodoItem getLatestTodoItem() {
        return service.getLatestTodoItem();
    }

    public void importData(String importString) {
        service.importData(importString);
    }
}